Emit null pushed_at instead of a zero date for commits#778
Merged
Conversation
GitHub deprecated the GraphQL Commit.pushedDate field and now always returns null for it (verified against the live API). The commits and commit-files queries mapped that null straight into a time.Time field, so every row showed a bogus pushed_at of 0001-01-01 instead of an empty value. Make the pushed_at field nullable and emit nil when the pushed date is absent, so it renders as a null cell rather than the Go zero date. Fixes grafana#469 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
1 similar comment
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Fixes #469.
The Commits (and Commit Files) query types show an incorrect
pushed_attimestamp — every row is0001-01-01.The root cause is that GitHub deprecated the GraphQL
Commit.pushedDatefield and now always returnsnullfor it. Verified against the live API:{ repository(name:"github-datasource", owner:"grafana") { object(expression:"main") { ... on Commit { history(first:5) { nodes { committedDate authoredDate pushedDate } } } } } }→
pushedDateisnullfor every commit (committedDate/authoredDateare populated).The code mapped that null straight into a non-nullable
time.Timefield, so it surfaced as the Go zero date0001-01-01on every row.Fix
Make
pushed_atnullable (*time.Time) and emitnilwhen the pushed date is absent, so it renders as a null cell instead of a bogus zero date. Applied to both the commits and commit-files frames via a smallnullableTimehelper.Tests
Updated
TestCommitsDataframeso the first commit has no pushed date (matching real API behavior) and the second keeps one, exercising both the null and populated paths. Golden files regenerated —pushed_atis now"nullable": trueand the null commit yieldsnull.go test ./pkg/...is green.